package com.huang.strategic.v2;

import com.huang.strategic.v1.CashierNormal;
import com.huang.strategic.v1.CashierRebate;
import com.huang.strategic.v1.CashierReturn;
import com.huang.strategic.v1.CashierSuper;

/**
 * <p></p>
 *
 * @author aneng huang
 * @since 2020-10-27 16:23:37
 */
public class CashierContext {

    private CashierSuper cashierSuper;


    public double getResult(double money) {
        return cashierSuper.acceptCash(money);
    }

    public CashierContext(String type) {
        switch (type) {
            case "0":
                cashierSuper = new CashierNormal();
                break;
            case "1":
                cashierSuper = new CashierRebate("0.8");
                break;
            case "2":
                cashierSuper = new CashierReturn("300", "100");
                break;
            case "3":
                cashierSuper = new CashierRebate("0.7");
                break;
            case "4":
                cashierSuper = new CashierRebate("0.6");
                break;
            case "5":
                cashierSuper = new CashierRebate("0.5");
                break;
            default:

        }
    }


}
